Skip to content

Report MSBuild test task failures and fix pipe listener and log lifetime - #12711

Open
Azat Mukhametshin (azat-msft) wants to merge 3 commits into
azat-msft-migrate-pipe-hardening-prsfrom
dev/azat-msft/mtp-pipe-hardening-followup
Open

Azat Mukhametshin (azat-msft) wants to merge 3 commits into
azat-msft-migrate-pipe-hardening-prsfrom
dev/azat-msft/mtp-pipe-hardening-followup

Conversation

@azat-msft

@azat-msft Azat Mukhametshin (azat-msft) commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Pull request

Summary

Follow-up to #12710, stacked on it. It makes the MSBuild test task (InvokeTestingPlatformTask) report its own failures and clean up its pipes and log.

  • If the output log cannot be created (I/O error or access denied), the task logs an MSBuild error and fails. Before, the exception escaped on a pipe connection. Module info is stored only after its log exists, so a later ModuleInfoRequest (for example from Retry) tries again.
  • When the default log for an invalid command line cannot be created, the captured output is logged directly instead of a "run failed" error that points at a missing file.
  • When the tests pass but a log error was reported, MSBuild changes the exit code to -1. The task no longer adds a misleading "Tests failed" error in that case.
  • If the IPC connection loop fails, the task fails even when the test application exits with 0.
  • Pipe servers that never got a client are disposed, and servers use the task's cancellation token instead of CancellationToken.None.
  • Dispose() always runs (in finally). The log is closed only after the connection loop and servers stop.
  • PACKAGE.md notes that a log creation failure is reported as an MSBuild error.

Design and decision record

Robustness and lifetime fixes; no separate record.

Demonstration

Not applicable. No rendered output changes.

Validation and regression proof

Windows, Debug, repo SDK, on this commit:

  • Microsoft.Testing.Platform.MSBuild.UnitTests.exe, net10.0 and net11.0: 484 total, 479 passed, 5 skipped, 0 failed.
  • After .\build.cmd -pack, Microsoft.Testing.Platform.Acceptance.IntegrationTests.exe --filter "FullyQualifiedName~MSBuildLogFileTests": 3/3. The existing MSBuildTests_Test cases passed on an earlier revision, except Invoke_TestTarget_With_Incompatible_Arch. That test hangs on this machine inside CreateProcess for the arm64 app host, before any task code runs.

Not run: Linux, macOS, and MSBuild.exe on .NET Framework.

Test-value evidence

  • With this PR's src/MTP/Microsoft.Testing.Platform.MSBuild reverted to the base PR: 7 failures: Execute_OutputFileCreationFailureFailsTask (all 4 rows), Execute_UniqueLogCreationFailureFailsTask, Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt and Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask. All pass with the change.
  • With only the new exit-code -1 check removed: the 2 (True,*) rows of Execute_OutputFileCreationFailureFailsTask fail.
  • With the module recorded before its log is created (the old order): Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt fails.
  • Not covered by tests: the finally around Dispose(), the dispose order, and disposing servers that never connected. These are hard to observe in a unit test.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12711

Compared merge base 355f7b998694601aa5a5163bb6ee2ff9e8d06fb3 with head b33306dc32015f1a714f874058ea4146aa7b921f. Evidence applies to this head only.

Test-value evidence

All results are static predictions. No paired execution records were available, and no tests were run.

Contract Test / decisive assertion Counterfactual Evidence
Log-creation IOException or UnauthorizedAccessException fails the task with a reported error and no MSB6003 Execute_OutputFileCreationFailureFailsTask (4 data rows): Assert.IsFalse(Execute()), the message is in errors, no MSB6003, and the exact error count Before the fix the exception escapes the task, so DoesNotContain MSB6003 and IsFalse should fail Static prediction: likely killed
A writer-initialization failure disposes the stream and fails the task Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask: stream.CanWrite is false, the flush error is reported, IsFalse(Execute()) Without the output.Dispose() in the catch, the stream stays writable Static prediction: likely killed
Pipe server disposal and token use, Dispose() in finally, _hasInfrastructureError handling No dedicated test Dropping the finally disposal or the pipe cleanup would not be detected by the new tests Unverified. Not asserted by the new tests (a gap, not a proven defect).
PACKAGE.md wording None None Not applicable (documentation)

🧵 Parallel safety

The parallel-safety-reviewer specialist subtask was not run in this pass, so coverage is incomplete: STATUS: PARTIAL. Static inspection of the changed tests found no cross-test hazards. Each test creates its own AppHostTaskFixture, StubFileSystem and MemoryStream. No parallelization configuration changed. Treat this as unconfirmed; re-run /parallel-audit for a full result.

Per-test assessment

Pseudo-mutation evidence below consists of static predictions, not executed mutation results.

Result Quality Test Notes Follow-up
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_OutputFileCreationFailureFailsTask Covers all four module and exception combinations with exact error counts and codes. None
Pass B (80–89) new InvokeTestingPlatformTaskTests.Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask Asserts disposal and the reported flush error. It does not assert an exact error count. No change justified: the claimed contract (stream disposed, failure reported) is protected.

No inline comments were published.

<sub>This advisory review is heuristic and non-blocking.

Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto (Claude Sonnet 5.5) · ~30 AIC · ⌖ ~2 AIC · ⊞ 8.5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Generated by Copilot expert-reviewer — workflow run

Reviewed PR #12711 (MSBuild task pipe-server lifetime, log-creation failure handling, new unit tests). No blocking issues found.

Verified

  • Resources.MSBuildResources.TestFailedNoDetail exists in MSBuildResources.resx (Tests failed: {0}, with a comment) and has xlf entries for all locales, so no localization work is missing.
  • NamedPipeServer.WasConnected exists and is set when a client connects. DisposeAsync exists, so the #if NET split is valid.
  • Disposing the log after the connection loop and servers have stopped fixes the leaked-writer race described in the comment.

Non-blocking observations

  1. _hasInfrastructureError is a plain field written from pipe-handler and loop threads. Execute() reads it after Dispose(), which waits for the loop, so the final read is fine. HandleTaskExecutionErrors runs earlier, inside base.Execute(), and can race with a late ModuleInfoRequest. Consider volatile (or Volatile.Read/Write) for clarity.
  2. Execute() now calls Dispose() in finally, and callers may dispose again (using in tests, MSBuild). Please confirm NamedPipeServer.Dispose() is idempotent. A second Dispose() on an already disposed server in _connections should be a no-op. A short test with a double Dispose() would lock this in.
  3. In HandleTaskExecutionErrors, the _hasInfrastructureError && ExitCode == -1 short-circuit relies on ToolTask's behaviour of turning exit code 0 into -1 when errors were logged. A real exit code of -1 combined with an infrastructure error would also be swallowed. That is acceptable, since the error was already reported.
  4. The TryInitializeOutputFile catch only covers IOException and UnauthorizedAccessException. That matches the intent, and the tests exercise both exceptions.

Test-value evidence
Not executed (read-only review). By static prediction, Execute_OutputFileCreationFailureFailsTask fails on the base revision because the exception goes unhandled on the pipe connection (the test asserts no MSB6003). The writer-initialization test covers the stream-disposal path. I could not confirm red/green runs from the diff alone.

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the dev/azat-msft/mtp-pipe-hardening-followup branch from b33306d to 7702ef4 Compare December 2, 2026 16:42
@azat-msft

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Expert Code Review (command) completed successfully!

Expert Code Review (command)

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Expert Code Review (command) · auto (Claude Sonnet 5.5) · ~59 AIC · ⌖ ~1 AIC · ⊞ 7.2K · ◷

Generated by Expert Code Review (command)

@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the infrastructure-error reporting and resource-cleanup changes.

No open issues 🎉

What changed in this PR

Builds on #12710 to make Microsoft.Testing.Platform’s MSBuild task report infrastructure failures accurately and clean up pipe and log resources reliably.

Changes:

  • Reports log-creation and connection-loop failures without misleading test-failure messages.
  • Adds guaranteed cleanup, cancellation-aware pipe servers, and safer log disposal ordering.
  • Adds failure-path regression tests and documents log-creation errors.

Confidence at a glance

🟡 MSBuild task validation

Test-value evidence: The author reports five regression cases failing without the fixes and passing on the submitted revision. Acceptance tests passed one revision earlier. Execution artifacts were not independently verified; pipe cleanup and disposal ordering remain untested.

File Description
test/​UnitTests/​Microsoft.Testing.Platform.MSBuild.UnitTests/​InvokeTestingPlatformTaskTests.cs Tests log-creation failures, error reporting, and stream cleanup.
src/​MTP/​Microsoft.Testing.Platform.MSBuild/​Tasks/​InvokeTestingPlatformTask.Execution.cs Handles infrastructure failures and guarantees execution cleanup.
src/​MTP/​Microsoft.Testing.Platform.MSBuild/​Tasks/​InvokeTestingPlatformTask.cs Tracks infrastructure errors and closes pipes before the log.
src/​MTP/​Microsoft.Testing.Platform.MSBuild/​PACKAGE.md Documents MSBuild errors when log creation fails.

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Reviewed by Copilot (expert-reviewer) — workflow run

Summary: No blocking findings. I reviewed the diff statically and did not execute the PR's code.

Verified

  • Resources.MSBuildResources.TestFailedNoDetail already exists in MSBuildResources.resx (line 161) and in all the .xlf files. The PR adds no resource, so no localization regeneration is needed.
  • NamedPipeServer.WasConnected exists as a public getter, so the new finally dispose check compiles.
  • _hasInfrastructureError is volatile, which suits its writes from pipe-connection threads and its read on the task thread.
  • Dispose() now disposes the log stream only after the connection loop and all servers have stopped. That closes the leak where a late ModuleInfoRequest creates a log after disposal.
  • Execute() calls Dispose() in a finally. _waitForConnections.Cancel() moved into Dispose(), so the cancel still happens.
  • TryInitializeOutputFile disposes the raw stream if the StreamWriter constructor throws. It catches only IOException and UnauthorizedAccessException, so unrelated bugs still surface.
  • The change adds no public API. The PACKAGE.md sentence matches the new behavior.

Non-blocking notes

  • Dispose() is now called both in Execute() and possibly by the caller. Cancel() and Wait() are idempotent, but confirm that serverInstance.Dispose() and _outputFileStream?.Dispose() tolerate a second call, which is true of the framework types.
  • A server created with _waitForConnections.Token can cancel its own read loop at task end. This is intended, but the tests only cover this indirectly.
  • The tests cover creation failure (IO and access denied, with and without a module). A short test that a failed first ModuleInfoRequest lets a later one retry would lock in the _moduleInfo assignment ordering.

Test-value evidence: Static assessment only. The new tests target the reported defect (a log-creation failure must fail the task). I did not run them and did not check them against the pre-fix revision.

@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the dev/azat-msft/mtp-pipe-hardening-followup branch from 7702ef4 to d758a69 Compare December 2, 2026 17:06
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@azat-msft

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12711

Compared merge base d807174f039e1e7afb446a3b44c6eca56fae4c96 with head 7702ef4c961e740647a59f79cebd22bce2ad06f0. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions. No paired execution records were available, and this workflow does not run tests.

Contract Test and decisive assertion Counterfactual Result
A log-creation IO or access failure fails the task with a reported error instead of throwing Execute_OutputFileCreationFailureFailsTask (4 data rows): Assert.IsFalse(task.Execute()), the error message is present, and there is no MSB6003 Without the TryInitializeOutputFile catch, the exception escapes the pipe handler and the task could succeed or surface MSB6003 Static prediction: likely detected
Error count: one error when a module exists, otherwise two including run failed The same test, HasCount(1) and HasCount(2) with ContainsSingle("run failed") Without the _hasInfrastructureError handling in HandleTaskExecutionErrors and Execute, the count or the run failed error would differ Static prediction: likely detected
A stream is disposed when writer initialization throws Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask: Assert.IsFalse(stream.CanWrite) plus the flush error message Without output.Dispose() in the catch block, CanWrite stays true Static prediction: likely detected. StreamWriter.AutoFlush = true flushes in the setter, which triggers the failing Flush
The connection loop passes the cancellation token, disposes never-connected servers, and Execute disposes in a finally No dedicated test None Unverified. This is untested pipe lifecycle behavior; I judge it low risk
PACKAGE.md wording N/A N/A Not applicable (documentation)

🧵 Parallel safety

STATUS: PARTIAL. The separate specialist task was not run. A manual look found that the new tests use per-test AppHostTaskFixture and StubFileSystem instances, with no shared static state or paths. This is not a full analysis. No parallelization configuration changed, and no [DoNotParallelize] concern was identified.

Per-test assessment

Pseudo-mutation evidence below consists of static predictions, not executed mutation results.

Result Quality Test Notes Follow-up
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_OutputFileCreationFailureFailsTask It checks the failure result, error message, absence of MSB6003 and exact error counts across 4 data rows. None.
Pass B (80–89) new InvokeTestingPlatformTaskTests.Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask It checks disposal and the error message, but not the error count. No change justified: the asserted contract (stream disposed, task fails with the error) is fully covered.

No inline comments were queued. I found no supported defect or concrete improvement.

This advisory review is heuristic and non-blocking. Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto (Claude Sonnet 5.5) · ~32 AIC · ⌖ ~2 AIC · ⊞ 8.5K

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the failure-reporting and resource-cleanup changes.

No open issues 🎉

Review effort: Balanced

@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the state/needs-review Awaiting review from the team. label Dec 2, 2026
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Dec 2, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the infrastructure-error handling and resource-cleanup changes, though validation gaps remain.

No open issues 🎉

Review effort: Balanced

@github-actions

This comment has been minimized.

@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the dev/azat-msft/mtp-pipe-hardening-followup branch from 12b925a to feed5d7 Compare December 2, 2026 22:22
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12711

Compared merge base 86ee20cad57f747fe9472ae3a85157485f3cf5c3 with head feed5d77b67fec0084bce8b29f8a8d55cc2c9e41. Evidence applies to this head, not every intermediate commit. This was a static, read-only review; no tests were run.

Test-value evidence

Contract Test / decisive assertion Counterfactual Evidence
A log-creation IOException or UnauthorizedAccessException fails the task with an MSBuild error instead of escaping as MSB6003. Execute_OutputFileCreationFailureFailsTask, all 4 data rows. Asserts Execute() is false, the message is logged, and there is no MSB6003. Without TryInitializeOutputFile and _hasInfrastructureError, the exception escapes or the task reports success. Static prediction: likely killed. Unverified.
Failure of the unique fallback log name fails the task. Execute_UniqueLogCreationFailureFailsTask. Asserts a single error and no created files. Reverting to the old unhandled second CreateNew throws instead. Static prediction: likely killed.
A failed first ModuleInfoRequest does not claim the module, so a retry can create the log. Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt. Asserts the single created file is retry/...log. Assigning _moduleInfo before the log exists leaves no log for the retry. Static prediction: likely killed.
The stream is disposed when StreamWriter initialization fails. Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask. Asserts stream.CanWrite is false and the flush error is logged. Removing the catch { output.Dispose(); throw; } leaves the stream writable. Static prediction: likely killed.
Pipe-server cleanup and cancellation token, Dispose() in finally, and _hasInfrastructureError set when the connection loop fails. No dedicated test: NamedPipeServer is not exercised through the simulated task. Not assessed. Unprotected by changed tests. Unverified. An existing test may cover it.
PACKAGE.md wording. Not applicable (documentation). Not applicable. Not applicable.

No accessible revision-matched execution records were inspected, so none of the above is executed evidence.

🧵 Parallel safety

PARALLEL-SAFETY RESULT
STATUS: PARTIAL

The parallel-safety-reviewer subtask was not run, so parallel-safety coverage is incomplete and this is not an all-clear. The changed tests use per-test fixtures, a StubFileSystem and a mocked IBuildEngine. I saw no shared static state in the diff, but that was not a full assembly analysis.

Per-test assessment

Pseudo-mutation evidence is static prediction, not executed mutation results.

Result Quality Test Notes Follow-up
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_OutputFileCreationFailureFailsTask Covers both exception types and the with/without-module paths, with exact error counts. None.
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_UniqueLogCreationFailureFailsTask Asserts the single error message and that no file was created. None.
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt Asserts both the single error and the exact retry log path. None.
Pass B (80–89) new InvokeTestingPlatformTaskTests.Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask Checks disposal and the logged message, but not the error count. No change justified: the disposal assertion protects the claimed contract.

This advisory review is heuristic and non-blocking. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto (Claude Sonnet 5.5) · ~31 AIC · ⌖ ~2 AIC · ⊞ 8.5K

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 2, 2026
@github-actions

This comment has been minimized.

…time

Follow-up to the pipe and task log hardening:
- Report output-log creation failures as MSBuild errors and fail the task instead of
  letting the exception escape a pipe connection; retry log creation on a later
  ModuleInfoRequest.
- Fail the task when the IPC connection loop fails, even if the child exited 0.
- Dispose pipe servers that never received a client, tie them to the task's
  cancellation, always run Dispose(), and close the log only after the servers stop.
- Document the log naming and pipe access behavior in PACKAGE.md.

Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The flag is set on pipe-connection threads and read on the task thread.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the azat-msft-migrate-pipe-hardening-prs branch from 86ee20c to 61453b3 Compare December 4, 2026 12:37
@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the dev/azat-msft/mtp-pipe-hardening-followup branch from feed5d7 to 4886753 Compare December 4, 2026 12:37
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 4, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12711

Compared merge base 61453b3df2615d55ff028b0f81e10f8162264974 with head 4886753c3027be58b45a5edec90b5f1f6f565fd2. Evidence applies to this head only. No existing review threads were present, and no earlier report covers this head.

Test-value evidence

All entries are static predictions. No paired execution records were accessible, and this workflow did not run tests.

Contract Test and decisive assertion Counterfactual Evidence
Log-creation IO or access failure fails the task with an MSBuild error, not an escaped exception Execute_OutputFileCreationFailureFailsTask: IsFalse(Execute()), message present, no MSB6003 Without the TryInitializeOutputFile catch, the exception escapes the direct HandleRequestAsync call and the test errors Static: likely detected
Unique fallback name failure is reported Execute_UniqueLogCreationFailureFailsTask: single error, no created files Unhandled fallback exception Static: likely detected
A failed first ModuleInfoRequest does not claim the module Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt: exact retry log path Assigning _moduleInfo before the log exists skips the retry Static: likely detected
Stream is disposed when writer initialization fails Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask: IsFalse(CanWrite) Without output.Dispose() in the catch, the stream stays writable Static: likely detected
Pipe lifecycle: token passing, finally disposal, never-connected disposal, log disposal order No decisive test Not evaluated Unverified. A gap, not a proven defect.
MSB6003 guard in Execute_OutputFileCreationFailureFailsTask Harness overrides ExecuteTool and never launches a process — Observation: this guard cannot fail for the reason it names. The other assertions carry the protection.
PACKAGE.md wording None — Not applicable (documentation)

🧵 Parallel safety

STATUS: CLEAN. The specialist found the assembly MethodLevel (Workers 0) with no .runsettings, testconfig.json, or DoNotParallelize override. The new tests use per-test fixtures, stubs, and mocks. The class-level read lock on the shared MSBuild compatibility cache covers the one shared static it reaches. Analyzer firing was not confirmed by a build.

Per-test assessment

Pseudo-mutation evidence is static prediction only.

Result Quality Test Notes Follow-up
Failed D (60–69) new InvokeTestingPlatformTaskTests.Execute_OutputFileCreationFailureFailsTask Final assertions branch on hasModule, so one method encodes two outcomes. Use fixed per-row expectations; see inline request.
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_UniqueLogCreationFailureFailsTask Exact single error and no created file. None
Pass A (90–100) new InvokeTestingPlatformTaskTests.Execute_ModuleInfoRetryCreatesLogAfterFailedFirstAttempt Exact single error and the exact retry log path. None
Pass B (80–89) new InvokeTestingPlatformTaskTests.Execute_OutputWriterInitializationFailureDisposesStreamAndFailsTask Asserts disposal and the reported flush message, without an error count. No change justified: the disposal assertion protects the claimed contract.

One inline improvement request is queued for the hasModule branch. No other inline findings were found.

This advisory review is heuristic and non-blocking.

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · routed: haiku55 xhigh · ~177 AIC · ⌖ ~2 AIC · ⊞ 15.9K

Assert.Contains(error => error.Message!.Contains(message, StringComparison.Ordinal), errors);
// ToolTask reports exceptions that escape the task as MSB6003; the failure must be handled by the task itself.
Assert.DoesNotContain(error => error.Code == "MSB6003", errors);
if (hasModule)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test review · Improvement · Grade D (60–69): The final assertions branch on hasModule, so one data-driven test checks two different outcomes. The shared failure contract (result, message, no MSB6003) is correct, but the branch caps Structure at D.

Copilot Replace the if (hasModule) / else block after Execute() with fixed per-row expectations. Keep the shared checks for the false result, the message, and no MSB6003. Assert the expected error count per row (1 with a module, 2 without) and assert the run failed error only where the row expects it, without control flow in the test body. Acceptance: no if after Execute(), all four rows pass, and the rows still fail when TryInitializeOutputFile is reverted to the unhandled-exception path.

Replacement: none. This read-only review did not compile a replacement.

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 4, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 4, 2026
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1708414

This final resolution supersedes any earlier preliminary comment. Analysis mode is full. Evidence is incomplete: two artifact downloads failed and the Windows unit-test results are absent, so the build is not clean. One actionable, deterministic Linux failure is confirmed.

1. Deterministic Linux MSBuild task failure (actionable, high confidence)

  • Test: Execute_RepeatedRunWithLongAssemblyNameKeepsUniqueLogNameWithinLimit in test/UnitTests/Microsoft.Testing.Platform.MSBuild.UnitTests/InvokeTestingPlatformTaskTests.cs (line 334). Affected cases: "a", "é", "😀" on net10.0 and net11.0, Linux Release job.
  • Signature: Assert.ContainsSingle(fileSystem.CreatedFiles.Keys), expected 1, actual 0. No log file was created.
  • Recurrence: 6 of 6 cases fail identically in CTRF and TRX. All three retry attempts fail too. No fail-then-pass, so this is not flakiness.
  • The failure is identical for ASCII, accented, and surrogate-pair names, so Unicode handling is not implicated.
  • History: no prior occurrences in the collected history, which was not flagged incomplete. The test is absent from the local checkout, which suggests it was added on this PR branch. I have not verified this against the diff.
  • Ownership: PR author. The path is the MSBuild task's log naming and lifetime, the area this PR changes.
  • Next step: run this test locally in the Release configuration. Compare log-file creation in the repeated-run path between the PR head and the merge base.

2. Windows application-model acceptance: fixture build failures (environmental, not test logic)

  • Affected: ClassicUwp_ConsumesUapAssets_AndRunsPlainAndUiTestsThroughMtp (MSTest.Sdk, MSTest, MSTest.TestAdapter), ModernUwp_BuildsMtpPackageForArchitecture (x86, ARM64), ModernUwp_Net10, ModernUwp_Net11, ModernUwp_UnsupportedDeployment, and ModernUwp_ConsumesUwpAssets.
  • Signature: "Building the real UWP asset failed", with Cmd.exe exited with code '2'. The first error is a NuGet restore error in NuGet.targets, which the evidence truncates.
  • Every attempt failed. None passed.
  • Classification: fixture build or restore failure on the Windows agent, not a product assertion. Route to build-failure triage. Not issue-worthy on this evidence.

3. Expected fixture failures, not regressions

  • The four NativeTests.Outcome TRX failures are deliberate. The fixture fails for Failed outcomes and fails the first attempt of Retry cases. The acceptance test expects exit code 2 for Failed.

4. Crash evidence

  • The Linux DuplicateProviderSlotsRetainTheirDiagnostics host aborts with exit 134 and UTA013/UTA014. These cases pass by design.
  • The 282 MB crash dump stays in Azure DevOps and was not inspected. The textual evidence does not confirm which process produced it, and no failed record links to it. There is no stable, actionable crash signature. If a real crash is suspected, a matching-OS human diagnostic session is required.

Escalation

  • No issue created. Finding 1 is confined to this PR branch and is owned by its author. Finding 2 is environmental. Finding 3 is intentional.
  • No matching open or closed issue was found.
  • No slowness regression: there are zero historical duration samples.

Next steps

  1. Fix Execute_RepeatedRunWithLongAssemblyNameKeepsUniqueLogNameWithinLimit, or explain why its expectation changed.
  2. Re-collect the Windows unit-test artifacts before treating the Windows legs as clean.
  3. Triage the Windows UWP fixture restore failure through build-failure triage.

Confidence: high for finding 1. Medium for the root cause of finding 2.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · routed: haiku55 xhigh · ~52 AIC · ⌖ ~2 AIC · ⊞ 3.2K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants